#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSceneBuffDao:DaoBase<TableSceneBuff>
    {
        public override string GetFileName()
        {
            return "TableSceneBuff.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSceneBuff>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableSceneBuff model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.sceneBuffId)) UnityEngine.Debug.LogError("数据表id重复:TableSceneBuff->id: " + model.sceneBuffId);
            #endif
            cachePrimaryInt[model.sceneBuffId] = model;
        }
        protected override TableSceneBuff ParseRowData(string[] rowData)
        {
            TableSceneBuff data = new TableSceneBuff();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.sceneBuffId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.buffType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.valueEffect = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.basePercentEffect = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.currentPercentEffect = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.duration = long.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.tickTime = long.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.replaceType = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.priority = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.saveType = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.showOrNot = int.Parse(rowData[10]);
            }
            return data;
        }
    }
}
